<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LeftAd</title>
<style type="text/css">
body,div,form,input,img{ margin:0px; padding:0px;}
.bt{ background:url(images/LeftAd.gif) no-repeat; border:0px; width:144px; height:32px; position:relative; margin-bottom:8px;}
</style>
</head>
<body onresize="_size()" style="height:5000px;">
<div id="box" style="z-index:999; position:absolute; width:145px; height:160px; left:0px;">
<form name="">
<input id="bbt1" type="button" style=" left:-115px;" class="bt" value="1" onmouseover="_outin(1,1)" onmouseout=javascript:window.setTimeout("_outin(1,-1)",1000) />
<input id="bbt2" type="button" style=" left:-115px;" class="bt" value="2" onmouseover="_outin(2,1)" onmouseout=javascript:window.setTimeout("_outin(2,-1)",1000)  />
<input id="bbt3" type="button" style=" left:-115px;" class="bt" value="3" onmouseover="_outin(3,1)" onmouseout=javascript:window.setTimeout("_outin(3,-1)",1000)  />
<input id="bbt4" type="button" style=" left:-115px;" class="bt" value="4" onmouseover="_outin(4,1)" onmouseout=javascript:window.setTimeout("_outin(4,-1)",1000)  /></form></div>
<div style="float:right; width:200px; height:100px;"><input type="text" id="111" value="" /></div>
</body>
<script language="javascript">
function _size(){
	h=document.documentElement.clientHeight;
	w=document.documentElement.clientWidth;
}
function _test(){
	temp=document.documentElement.scrollTop+document.body.scrollTop;
	diff=0.05*((temp+(h-parseInt(Box.style.height))/2)-newH);
	if(diff>0){
		diff=Math.ceil(diff);
	}
	else{
		diff=Math.floor(diff);
	}
	cunt+=diff;
	newH=(h-parseInt(Box.style.height))/2+cunt;
	Box.style.top=newH+"px";
	
}
function _outin(i,flag){
	var speed=40,time;
	time=window.setInterval("_move("+i+","+flag+")",speed);
	window.setTimeout("window.clearInterval("+time+")",960);
}
function _move(i,flag){
	var bt=document.getElementById("bbt"+i);	
	var step=5,moveto=0;
	moveto=parseInt(bt.style.left)+flag*step;
	if(moveto>=-115&&moveto<=0){
		bt.style.left=moveto+"px";
		document.getElementById("111").value=(parseInt(bt.style.left)<-115);
	}else if(moveto>0){
		bt.style.left="0px";
	}else if(moveto<-115){
		bt.style.left="-115px";
	}
//	bt.style.left=moveto+"px";
//	document.getElementById("111").value=bt.style.left;
	
}
var h,w,newH=0,newW,temp,diff,cunt=0;
var Box=document.getElementById("box");
h=document.documentElement.clientHeight;
window.setInterval("_test()",20);
</script>
</html>
